<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
 	<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0,         maximum-scale=1.0, user-scalable=no,minimal-ui" />
    <title>忘记密码</title>
    <link rel="stylesheet" href="__PUBLIC__/Mobile/css/base.css">
    <link rel="stylesheet" href="__PUBLIC__/Mobile/css/forget_password.css"/>
    <script src="__PUBLIC__/Mobile/js/jquery-1.7.2.min.js"></script>
    <script src="__PUBLIC__/Mobile/layer/layer.min.js"></script>
</head>
<body>
	<div class="title">
    	<div class="back_btn">
           <a href="javascript:history.back(-1);"> <img src="__PUBLIC__/Mobile/images/arrow.png" style="width:20%;"></a>
        </div>
        <p>找回密码</p>
    </div>
    <div class="mima clearfix">
    	<div class="mima_icon">
        	<div class="user_icon">
            </div>
        </div>
        <input type="tel" placeholder="请输入需要找回的手机号码" name="phone">
    </div>
    <div class="dl_btn">
    	<div class="dl_btn_son" id="button">找回密码</div>
    </div>
    <script>
    $("#button").click(function(){
		var phone = $("input[name=phone]").val();
		if(!phone){
			layer.msg('手机号码不能为空',2);
			return false;
		}
		if(!(/^1[3|4|5|7|8]\d{9}$/.test(phone))){ 
			layer.msg('请填写正确的手机号码',2);  
	        return false; 
	    }
		$.ajax({
			url: "{:U('User/forget_password')}",
            type: "POST",
            data: {phone:phone},
            dataType: "json",
            success: function(result){
            	if(result.isok=='ok'){
              	   location.href = "{:U('User/find_password')}?phones="+result.phone;
                 }else if(result.isok=='off'){
                	 layer.alert('您的号码已还未注册过,请先注册',3);
                	 location.href = "{:U('User/reg')}";
                 }    
            }
        });
		
	});
    </script>
</body>
</html>